<form method="POST">
    <table>
        <tr>
            <td>Min Like </td> 
            <td><input type="text" name="min"></td>   
        </tr>
        <tr>
            <td>Max Like </td> 
            <td><input type="text" name="max"></td>
        </tr>
        <tr>
            <td>Company  </td> 
            <td><select name="Company">
                    <option value="Student">-------------------------</option>
                        <?php
                        require_once './model/db.php';
                        $query = "SELECT * FROM companies";
                        $pages1 = getFilms($query);
                        //$pages1 = getPage($query);
                        ?>
                        <?php foreach ($pages1 as $page2): ?>  
                    <option value="Company">
                        <?php echo $page2['name'];?>     
                        <?php endforeach;?>

                    </option>
                </select></td>
        </tr>
        <tr>
            <td>App      </td>
            <td><select name="apps">
                    <option value="Student">----------------------------------------------------------------</option>
                        <?php
                        require_once 'model/db.php';
                        $query = "SELECT * FROM apps";
                        $pages2 = getFilms($query);   
                        ?>
                        <?php foreach ($pages2 as $page1): ?>                       
                    <option value="Student">
                        <?php echo $page1['name'];?>     
                        <?php endforeach;?>
                    </option>
                </select></td>
        </tr>
    </table>
    <input type="submit" name="submit" value="Search">
</form>
<?php
require_once './model/db.php';


$query = "SELECT * FROM pages LIMIT 0,50";
$pages = getFilms($query);
//$pages = getFlims($query);
?>
<?php if (isset($_POST['submit'])): ?>
    <?php $min = (double) $_POST['min']; ?>
    <?php $max = (double) $_POST['max']; ?>

  


<table border ="1">
    <tr>
        <th>Pid</th>
        <th>Image</th>
        <th>ID</th>
        <th>Name</th>
        <th>Username</th>
        <th>Phone</th>
        <th>Like</th>

    </tr>
    <?php foreach ($pages as $page): ?>
        <?php if ((int) $_GET . $page['likes'] >= ((int)$_POST['min'])
                   &&(int) $_GET . $page['likes'] <= ((int)$_POST['max'])): ?>
            <tr>
                <td><?php echo $page['pid'] ?></td>
                <td><img src='<?php echo $page['picture'] ?>'></td>
                <td><?php echo $page['id'] ?></td>
                <td><?php echo $page['name'] ?></td>
                <td><?php echo $page['username'] ?></td>
                <td><?php echo $page['phone'] ?></td>
                <td><?php echo $page['likes'] ?></td> 
            </tr>
        <?php endif; ?>

    <?php endforeach; ?>
</table>
 <?php endif; ?>
